In a multiprocessing environment, a plurality of processes execute on a processing system simultaneously, either on a single processor on a time-shared basis or on a multiplicity of processors. Often a plurality of processes in such an environment share the use of a resource, such as information stored in a memory. To ensure that access to the shared resource is made by only one process at a time, some locking mechanism must be used that allows only one process to access the resource at any one time, and locks out the other processes from accessing the resource at that time. In the case of shared information, the information is generally stored in memory, and hence the locking mechanism must control access to the memory, or at least to that portion of the memory wherein the shared information is stored.
A type of locking mechanism used widely in multiprocessing systems is a semaphore. A semaphore is traditionally implemented as a register or a designated memory location on which is performed a read-and-clear operation, a test-and-set operation, a read-modify-write operation, or some other form of a memory operation that performs an atomic read-modify-write function. An atomic read-modify-write function is one during whose execution no other register or memory references are permitted between the read and write portions of the operation.
In order to provide increased system reliability and to lessen contests between processors for memory access, some multiprocessor systems use duplicated, and perhaps even more extensively replicated, memories. For example, a coprocessing system commonly comprises two simultaneously-active but independent processors, each having its own memory that duplicates the contents of the other processor's memory. In multiprocessor systems having replicated memory, the concept of a semaphore has been extended to force a locking operation, such as a read-modify-write operation, to occur simultaneously in all replicated memories. For if one processor in such a system were to perform a locking operation on its own memory only, then it will have failed to signal the other processors that the information guarded by the semaphore is locked. And if the one processor were to lock all replicated memories but not at the same time, the possibility would ordinarily exist that more than one processor would lock its own memory and then attempt to lock the other memories, only to find that at least some of them have already been locked by other processors. This condition, known as deadlock, results in none of the processors getting access to the information that is protected by the lock.
While solving the deadlock problem, the requirement that the locking operation occur simultaneously in all replicated memories has serious drawbacks in terms of system performance. For while the various resources--such as communication buses required to access the memories--that are needed to perform the operation simultaneously are being marshalled in the plurality of processors, other processing activity of these processors must effectively cease and cannot continue until the necessary resources have been secured in all processors, the locking operation has been performed in all processors, and the marshalled resources have been released. The amount of time wasted in so synchronizing the execution of the locking operation in all processors may significantly impair the processing throughput of the multiprocessor system. From this standpoint, then, the need for such synchronization is undesirable.